<template>
  <div class="mt-p-address-provinces">
    <group>
      <cell
      v-for="(province, index) in provinces" 
      :key="index" 
      :title="province.name"
      @click.native="handleProvinceClick(province)"
      is-link></cell>
    </group>
  </div>
</template>

<script>
import {  Group, Cell } from "vux"

export default {
  data() {
    return {
      provinces: []
    }
  },
  mounted() {
    this.getProvinces()
  },
  methods: {
    async getProvinces(pid) {
      this.provinces = await this.$store.dispatch("getProvinces")
      return
    },
    handleProvinceClick(province) {
      this.$store.commit('setDemandProvince', province)
      this.$router.push('/trade/demands/post/address/citys')
    }
  },
  components: { Group, Cell }
}
</script>

<style lang="scss">
@import "../../../../../styles/index.scss";

</style>
